<?php
include($_SERVER['DOCUMENT_ROOT'] . "/admin/includes/interceptor.php");
include($_SERVER['DOCUMENT_ROOT'] . '/static/db/connect.php');

$sql = "select count(*) c from qt_page_view";
$mysqli_result = $mysqli->query($sql);
$total_pv = $mysqli_result->fetch_assoc()['c'];

$sql = "select count(*) c from qt_page_view where DATE_FORMAT(date,\"%Y,%m,%d\") = DATE_FORMAT(now(),\"%Y,%m,%d\")";
$mysqli_result = $mysqli->query($sql);
$today_pv = $mysqli_result->fetch_assoc()['c'];
$mysqli->close();

function GetDisk()
{ //获取硬盘情况
    $d['t'] = round(@disk_total_space(".") / (1024 * 1024 * 1024), 3);
    $d['f'] = round(@disk_free_space(".") / (1024 * 1024 * 1024), 3);
    $d['u'] = $d['t'] - $d['f'];
    $d['PCT'] = (floatval($d['t']) != 0) ? round($d['u'] / $d['t'] * 100, 2) : 0;
    return $d;
}

?>
<!--state overview start-->
<div class="row state-overview">
    <div class="col-lg-3 col-sm-6">
        <section class="panel">
            <div class="symbol terques">
                <i class="icon-user"></i>
            </div>
            <div class="value">
                <h1>0</h1>
                <p>在册会员</p>
            </div>
        </section>
    </div>
    <div class="col-lg-3 col-sm-6">
        <section class="panel">
            <div class="symbol red">
                <i class="icon-bar-chart"></i>
            </div>
            <div class="value">
                <h1><?php echo number_format($total_pv) ?></h1>
                <p>总访问量</p>
            </div>
        </section>
    </div>
    <div class="col-lg-3 col-sm-6">
        <section class="panel">
            <div class="symbol yellow">
                <i class="icon-shopping-cart"></i>
            </div>
            <div class="value">
                <h1><?php echo GetDisk()['PCT']; ?>%</h1>
                <p>硬盘使用率</p>
            </div>
        </section>
    </div>
    <div class="col-lg-3 col-sm-6">
        <section class="panel">
            <div class="symbol blue">
                <i class="icon-laptop"></i>
            </div>
            <div class="value">
                <h1><?php echo $today_pv ?></h1>
                <p>今日IP量</p>
            </div>
        </section>
    </div>
</div>
<!--state overview end-->

<div class="row">
    <div class="col-lg-8">
        <!--custom chart start-->
        <div class="border-head">
            <h3>月度访问量</h3>
        </div>
        <div class="custom-bar-chart">
            <div class="bar">
                <div class="title">JAN</div>
                <div class="value tooltips" data-original-title="80%" data-toggle="tooltip" data-placement="top">
                    80%
                </div>
            </div>
            <div class="bar doted">
                <div class="title">FEB</div>
                <div class="value tooltips" data-original-title="50%" data-toggle="tooltip" data-placement="top">
                    50%
                </div>
            </div>
            <div class="bar ">
                <div class="title">MAR</div>
                <div class="value tooltips" data-original-title="40%" data-toggle="tooltip" data-placement="top">
                    40%
                </div>
            </div>
            <div class="bar doted">
                <div class="title">APR</div>
                <div class="value tooltips" data-original-title="55%" data-toggle="tooltip" data-placement="top">
                    55%
                </div>
            </div>
            <div class="bar">
                <div class="title">MAY</div>
                <div class="value tooltips" data-original-title="20%" data-toggle="tooltip" data-placement="top">
                    20%
                </div>
            </div>
            <div class="bar doted">
                <div class="title">JUN</div>
                <div class="value tooltips" data-original-title="39%" data-toggle="tooltip" data-placement="top">
                    39%
                </div>
            </div>
            <div class="bar">
                <div class="title">JUL</div>
                <div class="value tooltips" data-original-title="75%" data-toggle="tooltip" data-placement="top">
                    75%
                </div>
            </div>
            <div class="bar doted">
                <div class="title">AUG</div>
                <div class="value tooltips" data-original-title="45%" data-toggle="tooltip" data-placement="top">
                    45%
                </div>
            </div>
            <div class="bar ">
                <div class="title">SEP</div>
                <div class="value tooltips" data-original-title="50%" data-toggle="tooltip" data-placement="top">
                    50%
                </div>
            </div>
            <div class="bar doted">
                <div class="title">OCT</div>
                <div class="value tooltips" data-original-title="42%" data-toggle="tooltip" data-placement="top">
                    42%
                </div>
            </div>
            <div class="bar ">
                <div class="title">NOV</div>
                <div class="value tooltips" data-original-title="60%" data-toggle="tooltip" data-placement="top">
                    60%
                </div>
            </div>
            <div class="bar doted">
                <div class="title">DEC</div>
                <div class="value tooltips" data-original-title="90%" data-toggle="tooltip" data-placement="top">
                    90%
                </div>
            </div>
        </div>
        <!--custom chart end-->
    </div>
    <div class="col-lg-4">
        <!--new earning start-->
        <div class="panel terques-chart">
            <div class="panel-body chart-texture">
                <div class="chart">
                    <div class="heading">
                        <span>三月</span>
                        <strong>23 Days | 65%</strong>
                    </div>
                    <div class="sparkline" data-type="line" data-resize="true" data-height="75"
                         data-width="90%" data-line-width="1" data-line-color="#fff" data-spot-color="#fff"
                         data-fill-color="" data-highlight-line-color="#fff" data-spot-radius="4"
                         data-data="[200,135,667,333,526,996,564,123,890,564,455]"></div>
                </div>
            </div>
            <div class="chart-tittle">
                <span class="title">日访问量统计图</span>
                <span class="value ">总访问量:12</span>
            </div>
        </div>
        <!--new earning end-->
    </div>
</div>

<script src="/admin/static/js/jquery.sparkline.js" type="text/javascript"></script>
<script src="/admin/static/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.js"></script>

<!--script for this page-->
<script src="/admin/static/js/sparkline-chart.js"></script>
<script src="/admin/static/js/easy-pie-chart.js"></script>